$OpenBSD: patch-Makefile,v 1.30 2017/04/04 21:24:44 ajacoutot Exp $
--- Makefile.orig	Sun Mar 26 21:48:24 2017
+++ Makefile	Tue Apr  4 15:31:27 2017
@@ -16,11 +16,6 @@ SYSNAME := $(shell uname -n)
 # No version number yet...
 VERSION=0.0
 
-# Installation prefix...
-PREFIX=/usr/local
-PREFIX=/usr
-PREFIX=$(DESTDIR)/usr
-
 # Pathnames for this package...
 BIN=$(PREFIX)/bin
 SHAREZJS=$(PREFIX)/share/foo2zjs
@@ -33,13 +28,13 @@ SHARESLX=$(PREFIX)/share/foo2slx
 SHAREHC=$(PREFIX)/share/foo2hiperc
 SHAREHBPL=$(PREFIX)/share/foo2hbpl
 SHAREDDST=$(PREFIX)/share/foo2ddst
-MANDIR=$(PREFIX)/share/man
+MANDIR=$(PREFIX)/man
 DOCDIR=$(PREFIX)/share/doc/foo2zjs/
 INSTALL=install
 ROOT=root
 
 # Pathnames for referenced packages...
-FOODB=$(DESTDIR)/usr/share/foomatic/db/source
+FOODB=$(PREFIX)/share/foomatic/db/source
 
 # User ID's
 LPuid=-oroot
@@ -252,9 +247,9 @@ FILES	=	\
 		$(NULL)
 
 # CUPS vars
-CUPS_SERVERBIN := $(DESTDIR)$(shell cups-config --serverbin 2>/dev/null)
-CUPS_DEVEL := $(shell grep cupsSideChannelDoRequest /usr/include/cups/sidechannel.h 2>/dev/null)
-CUPS_GOODAPI := $(shell cups-config --api-version 2>/dev/null | sed "s/1\.[0123].*//")
+CUPS_SERVERBIN := 1
+CUPS_DEVEL := 1
+CUPS_GOODAPI := 1
 
 # hpclj2600n-0.icm km2430_0.icm km2430_1.icm km2430_2.icm samclp300-0.icm
 # sihp1000.img sihp1005.img sihp1020.img sihp1018.img
@@ -304,7 +299,7 @@ endif
 
 # Compiler flags
 #CFLAGS +=	-O2 -Wall -Wno-unused-but-set-variable
-CFLAGS +=	-O2 -Wall 
+#CFLAGS +=	-O2 -Wall 
 #CFLAGS +=	-g
 
 #
@@ -436,12 +431,6 @@ all-test:
 	    echo "      ***"; \
 	    exit 1; \
 	fi
-	@if ! dc -V >/dev/null 2>&1; then \
-	    echo "      ***"; \
-	    echo "      *** Error: must install GNU dc with the -e option!"; \
-	    echo "      ***"; \
-	    exit 1; \
-	fi
 ifeq ($(UNAME),Darwin)
 	@if ! type gsed >/dev/null 2>&1; then \
 	    echo "      ***"; \
@@ -620,7 +609,7 @@ zjsdecode: zjsdecode.o $(LIBJBG)
 	$(CC) $(CFLAGS) zjsdecode.o $(LIBJBG) -o $@
 
 command2foo2lava-pjl: command2foo2lava-pjl.o
-	$(CC) $(CFLAGS) -L/usr/local/lib command2foo2lava-pjl.o -lcups -o $@
+	$(CC) $(CFLAGS) -L/usr/local/lib command2foo2lava-pjl.o -pthread -lcups -o $@
 
 command2foo2lava-pjl.o: command2foo2lava-pjl.c
 	$(CC) $(CFLAGS) -I/usr/local/include -c command2foo2lava-pjl.c
@@ -628,9 +617,8 @@ command2foo2lava-pjl.o: command2foo2lava-pjl.c
 #
 # Installation rules
 #
-install: all install-test install-prog install-icc2ps install-osx-hotplug \
+install: all install-prog install-icc2ps install-osx-hotplug \
 	    install-extra install-crd install-foo install-ppd \
-	    install-gui install-desktop install-filter \
 	    install-man install-doc
 	#
 	# If you use CUPS, then restart the spooler:
@@ -689,11 +677,6 @@ install-prog:
 	$(INSTALL) -d $(SHAREZJS)/
 	$(INSTALL) -c -m 644 gamma.ps $(SHAREZJS)/
 	$(INSTALL) -c -m 644 gamma-lookup.ps $(SHAREZJS)/
-	$(INSTALL) -d $(SHAREOAK)/
-	$(INSTALL) -d $(SHAREHP)/
-	$(INSTALL) -d $(SHAREXQX)/
-	$(INSTALL) -d $(SHARELAVA)/
-	$(INSTALL) -d $(SHAREHC)/
 
 install-foo:
 	#
@@ -712,24 +695,14 @@ install-foo:
 	#
 	# Install current database files
 	#
-	@if [ -d $(FOODB) ]; then \
+	echo install -d $(FOODB)
+	$(INSTALL) -d $(FOODB)
 	    for dir in driver printer opt; do \
 		echo install -d $(FOODB)/$$dir/; \
 		$(INSTALL) -d $(FOODB)/$$dir/; \
 		echo install -m 644 foomatic-db/$$dir/*.xml $(FOODB)/$$dir/; \
 		$(INSTALL) -c -m 644 foomatic-db/$$dir/*.xml $(FOODB)/$$dir/; \
 	    done \
-	else \
-	    echo "***"; \
-	    echo "*** WARNING! You don't have directory $(FOODB)/"; \
-	    echo "*** If you want support for foomatic printer configuration,";\
-	    echo "*** then you will have to manually install these files..."; \
-	    echo "***"; \
-	    ls foomatic-db/*/*.xml | sed 's/^/	/'; \
-	    echo "***"; \
-	    echo "*** ... wherever foomatic is stashed on your machine."; \
-	    echo "***"; \
-	fi
 	#
 	# Clear foomatic cache and rebuild database if needed
 	#
@@ -866,7 +839,7 @@ install-extra:
 	done
 
 MODEL=$(PREFIX)/share/cups/model
-LOCALMODEL=$(DESTDIR)/usr/local/share/cups/model
+LOCALMODEL=$(PREFIX)/share/foomatic/db/source/PPD/foo2zjs
 MACMODEL=/Library/Printers/PPDs/Contents/Resources
 PPD=$(PREFIX)/share/ppd
 VARPPD=/var/lp/ppd
@@ -874,43 +847,8 @@ install-ppd:
 	#
 	# Install PPD files for CUPS
 	#
-	export PATH=$$PATH:`pwd`:; \
-	if [ -x /usr/sbin/ppdmgr -a -s $(VARPPD)/ppdcache ]; then \
-	    $(INSTALL) $(LPgid) -d $(VARPPD)/user; \
-	    cd PPD; \
-	    for ppd in *.ppd; do \
-		manuf=`echo "$$ppd" | sed 's/-.*//'`; \
-		$(INSTALL) $(LPgid) -d $(VARPPD)/user/$$manuf; \
-		modify-ppd <$$ppd | gzip > $(VARPPD)/user/$$manuf/$$ppd.gz; \
-		chmod 664 $(VARPPD)/user/$$manuf/$$ppd.gz; \
-	    done; \
-	    ppdmgr -u; \
-	elif [ -d $(PPD) ]; then \
-	    find $(PPD) -name '*foo2zjs*' | xargs rm -rf; \
-	    find $(PPD) -name '*foo2hp*' | xargs rm -rf; \
-	    find $(PPD) -name '*foo2xqx*' | xargs rm -rf; \
-	    find $(PPD) -name '*foo2lava*' | xargs rm -rf; \
-	    find $(PPD) -name '*foo2qpdl*' | xargs rm -rf; \
-	    find $(PPD) -name '*foo2slx*' | xargs rm -rf; \
-	    find $(PPD) -name '*foo2hiperc*' | xargs rm -rf; \
-	    find $(PPD) -name '*foo2hbpl*' | xargs rm -rf; \
-	    [ -d $(PPD)/foo2zjs ] || mkdir $(PPD)/foo2zjs; \
-	    cd PPD; \
-	    for ppd in *.ppd; do \
-		modify-ppd <$$ppd | gzip > $(PPD)/foo2zjs/$$ppd.gz; \
-		chmod 664 $(PPD)/foo2zjs/$$ppd.gz; \
-	    done; \
-	fi
-	#
-	export PATH=$$PATH:`pwd`:; \
-	if [ -d $(MODEL) ]; then \
-	    rm -f $(MODEL)/KonicaMinolta*; \
-	    cd PPD; \
-	    for ppd in *.ppd; do \
-		modify-ppd <$$ppd | gzip > $(MODEL)/$$ppd.gz; \
-		chmod 664 $(MODEL)/$$ppd.gz; \
-	    done; \
-	elif [ -d $(LOCALMODEL) ]; then \
+	mkdir -p $(LOCALMODEL)
+	if [ -d $(LOCALMODEL) ]; then \
 	    rm -f $(LOCALMODEL)/KonicaMinolta*; \
 	    cd PPD; \
 	    for ppd in *.ppd; do \
@@ -1581,11 +1519,8 @@ install-doc: doc
 	#
 	$(INSTALL) -d -m 755 $(DOCDIR)
 	$(INSTALL) -c -m 644 manual.pdf $(DOCDIR)
-	$(INSTALL) -c -m 644 COPYING $(DOCDIR)
 	$(INSTALL) -c -m 644 INSTALL $(DOCDIR)
-	$(INSTALL) -c -m 644 INSTALL.osx $(DOCDIR)
 	$(INSTALL) -c -m 644 README $(DOCDIR)
-	$(INSTALL) -c -m 644 ChangeLog $(DOCDIR)
 
 GROFF=/usr/local/test/bin/groff
 GROFF=groff
